use of net.minecraft.item.DyeColor in project minecolonies by Minecolonies.
the class WindowBannerPicker method createCloseButtons.
/**
* Creates the Done and Cancel buttons, to return to the town hall window and save the banner or not, respectively.
*/
protected void createCloseButtons() {
this.addButton(new Button(center(this.width, 2, 80, 1, 10), this.height - 40, 80, SIDE, new TranslationTextComponent("gui.done"), pressed -> {
BannerPattern.Builder builder = new BannerPattern.Builder();
for (Pair<BannerPattern, DyeColor> pair : layers) builder.addPattern(pair.getFirst(), pair.getSecond());
colony.setColonyFlag(builder.toListTag());
window.open();
}));
this.addButton(new Button(center(this.width, 2, 80, 0, 10), this.height - 40, 80, SIDE, new TranslationTextComponent("gui.cancel"), pressed -> window.open()));
}
use of net.minecraft.item.DyeColor in project minecolonies by Minecolonies.
the class DefaultConcreteMixerCraftingProvider method registerRecipes.
@Override
protected void registerRecipes(@NotNull final Consumer<IFinishedRecipe> consumer) {
final List<ItemStorage> input = new ArrayList<>();
input.add(new ItemStorage(new ItemStack(Items.SAND, 4)));
input.add(new ItemStorage(new ItemStack(Items.GRAVEL, 4)));
for (final DyeColor color : DyeColor.values()) {
final String prefix = color.name().toLowerCase(Locale.ROOT);
final Item powder = ForgeRegistries.ITEMS.getValue(new ResourceLocation(prefix + "_concrete_powder"));
final Item concrete = ForgeRegistries.ITEMS.getValue(new ResourceLocation(prefix + "_concrete"));
final Item dye = ForgeRegistries.ITEMS.getValue(new ResourceLocation(prefix + "_dye"));
if (powder == null || concrete == null || dye == null) {
throw new IllegalStateException("Missing items for " + color.getSerializedName());
}
final List<ItemStorage> customInput = new ArrayList<>(input);
customInput.add(new ItemStorage(new ItemStack(dye)));
CustomRecipeBuilder.create(ModJobs.CONCRETE_ID.getPath() + "_custom", powder.getRegistryName().getPath()).inputs(customInput).result(new ItemStack(powder, 8)).build(consumer);
CustomRecipeBuilder.create(ModJobs.CONCRETE_ID.getPath() + "_custom", concrete.getRegistryName().getPath()).inputs(Collections.singletonList(new ItemStorage(new ItemStack(powder)))).result(new ItemStack(concrete)).build(consumer);
// TODO: it makes sense for this to have WATER as an intermediate, but the RS logic
// and JEI rendering don't currently support that. Previous versions just used
// air, so we'll do the same for now.
}
}
use of net.minecraft.item.DyeColor in project minecolonies by Minecolonies.
the class TileEntityColonyFlag method getItemClient.
/**
* Builds a mutable ItemStack from the information within the tile entity
* @return the ItemStack representing this banner
*/
@OnlyIn(Dist.CLIENT)
public ItemStack getItemClient() {
ItemStack itemstack = new ItemStack(ModBlocks.blockColonyBanner);
List<Pair<BannerPattern, DyeColor>> list = getPatternList();
ListNBT nbt = new ListNBT();
for (Pair<BannerPattern, DyeColor> pair : list) {
CompoundNBT pairNBT = new CompoundNBT();
pairNBT.putString(TAG_SINGLE_PATTERN, pair.getFirst().getHashname());
pairNBT.putInt(TAG_PATTERN_COLOR, pair.getSecond().getId());
nbt.add(pairNBT);
}
if (!nbt.isEmpty())
itemstack.getOrCreateTagElement("BlockEntityTag").put(TAG_BANNER_PATTERNS, nbt);
return itemstack;
}
use of net.minecraft.item.DyeColor in project Hyper-Lighting by Exploding-Creeper.
the class UnderwaterLantern method animateTick.
@Override
public void animateTick(BlockState state, World worldIn, BlockPos pos, Random rand) {
if (worldIn.isRemote && state.get(LIT)) {
DyeColor color = DyeColor.values()[rand.nextInt(DyeColor.values().length)];
Direction direction = state.get(HORIZONTAL_FACING);
double d0 = (double) pos.getX() + 0.5D;
double d1 = (double) pos.getY() + 0.7D;
double d2 = (double) pos.getZ() + 0.5D;
if (state.get(FACE) == AttachFace.WALL) {
Direction direction1 = direction.getOpposite();
worldIn.addParticle(ParticleTypes.SMOKE, d0 + 0.27D * (double) direction1.getXOffset(), d1, d2 + 0.27D * (double) direction1.getZOffset(), 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleRegistryHandler.CUSTOM_FLAME.get(), d0 + 0.27D * (double) direction1.getXOffset(), d1 - 0.3D, d2 + 0.27D * (double) direction1.getZOffset(), color.getColorComponentValues()[0], color.getColorComponentValues()[1], color.getColorComponentValues()[2]);
} else if (state.get(FACE) == AttachFace.FLOOR) {
worldIn.addParticle(ParticleTypes.SMOKE, d0, d1 - 0.3D, d2, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleRegistryHandler.CUSTOM_FLAME.get(), d0, d1 - 0.5D, d2, color.getColorComponentValues()[0], color.getColorComponentValues()[1], color.getColorComponentValues()[2]);
} else if (state.get(FACE) == AttachFace.CEILING) {
worldIn.addParticle(ParticleTypes.SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleRegistryHandler.CUSTOM_FLAME.get(), d0, d1 - 0.3D, d2, color.getColorComponentValues()[0], color.getColorComponentValues()[1], color.getColorComponentValues()[2]);
}
}
}
use of net.minecraft.item.DyeColor in project Hyper-Lighting by Exploding-Creeper.
the class UnderwaterTorch method animateTick.
@Override
public void animateTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
if (stateIn.get(LIT)) {
BasicParticleType particleData = ParticleRegistryHandler.CUSTOM_FLAME.get();
DyeColor color = DyeColor.values()[rand.nextInt(DyeColor.values().length)];
if (stateIn.get(ATTACH_FACE) == AttachFace.FLOOR) {
double d0 = (double) pos.getX() + 0.5D;
double d1 = (double) pos.getY() + 0.7D;
double d2 = (double) pos.getZ() + 0.5D;
worldIn.addParticle(ParticleTypes.SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D);
// xSpeed, ySpeed and zSpeed here is used to pass color data. This isn't the proper way, but I don't wanna add a bunch of extra code for something so simple
worldIn.addParticle(particleData, d0, d1, d2, color.getColorComponentValues()[0], color.getColorComponentValues()[1], color.getColorComponentValues()[2]);
} else {
Direction direction = stateIn.get(HORIZONTAL_FACING);
double d0 = (double) pos.getX() + 0.5D;
double d1 = (double) pos.getY() + 0.7D;
double d2 = (double) pos.getZ() + 0.5D;
double d3 = 0.22D;
double d4 = 0.27D;
Direction direction1 = direction.getOpposite();
worldIn.addParticle(ParticleTypes.SMOKE, d0 + 0.27D * (double) direction1.getXOffset(), d1 + 0.22D, d2 + 0.27D * (double) direction1.getZOffset(), 0.0D, 0.0D, 0.0D);
// xSpeed, ySpeed and zSpeed here is used to pass color data. This isn't the proper way, but I don't wanna add a bunch of extra code for something so simple
worldIn.addParticle(particleData, d0 + 0.27D * (double) direction1.getXOffset(), d1 + 0.22D, d2 + 0.27D * (double) direction1.getZOffset(), color.getColorComponentValues()[0], color.getColorComponentValues()[1], color.getColorComponentValues()[2]);
}
}
}
Aggregations