more fixes...

This commit is contained in:
Flanks255 2021-10-21 12:33:19 -05:00
parent f4c7ea0605
commit f3c30d547d
5 changed files with 26 additions and 17 deletions

View file

@ -35,19 +35,20 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import javax.annotation.Nullable;
import java.util.Random; import java.util.Random;
public class BlockCrusher extends BlockContainerBase { public class BlockCrusher extends BlockContainerBase {
private final boolean isDouble; private final boolean isDouble;
public BlockCrusher(boolean isDouble) { public BlockCrusher(boolean isDouble) {
super(ActuallyBlocks.defaultPickProps(0).tickRandomly()); super(ActuallyBlocks.defaultPickProps(0).randomTicks());
this.isDouble = isDouble; this.isDouble = isDouble;
this.setDefaultState(this.stateContainer.getBaseState().with(HORIZONTAL_FACING, Direction.NORTH).with(LIT, false)); this.registerDefaultState(getStateDefinition().any().setValue(HORIZONTAL_FACING, Direction.NORTH).setValue(LIT, false));
} }
@Override @Override
public TileEntity createNewTileEntity(IBlockReader worldIn) { public TileEntity newBlockEntity(IBlockReader worldIn) {
return this.isDouble return this.isDouble
? new TileEntityCrusherDouble() ? new TileEntityCrusherDouble()
: new TileEntityCrusher(); : new TileEntityCrusher();
@ -55,7 +56,7 @@ public class BlockCrusher extends BlockContainerBase {
@Override @Override
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random rand) { public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random rand) {
if (state.get(BlockStateProperties.LIT)) { if (state.getValue(BlockStateProperties.LIT)) {
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
double xRand = rand.nextDouble() / 0.75D - 0.5D; double xRand = rand.nextDouble() / 0.75D - 0.5D;
double zRand = rand.nextDouble() / 0.75D - 0.5D; double zRand = rand.nextDouble() / 0.75D - 0.5D;
@ -66,7 +67,7 @@ public class BlockCrusher extends BlockContainerBase {
} }
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (this.isDouble) { if (this.isDouble) {
return this.openGui(world, player, pos, TileEntityCrusherDouble.class); return this.openGui(world, player, pos, TileEntityCrusherDouble.class);
} }
@ -76,24 +77,24 @@ public class BlockCrusher extends BlockContainerBase {
@Override @Override
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockItemUseContext context) {
return this.getDefaultState().with(HORIZONTAL_FACING, context.getNearestLookingDirection().getOpposite()).with(LIT, false); return defaultBlockState().setValue(HORIZONTAL_FACING, context.getNearestLookingDirection().getOpposite()).setValue(LIT, false);
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> builder) {
builder.add(LIT).add(HORIZONTAL_FACING); builder.add(LIT).add(HORIZONTAL_FACING);
} }
@Override @Override
public int getLightValue(BlockState state, IBlockReader world, BlockPos pos) { public int getLightValue(BlockState state, IBlockReader world, BlockPos pos) {
return state.get(LIT) return state.getValue(LIT)
? 12 ? 12
: 0; : 0;
} }
@Override @Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
switch (state.get(HORIZONTAL_FACING)) { switch (state.getValue(HORIZONTAL_FACING)) {
case EAST: case EAST:
return Shapes.GrinderShapes.SHAPE_E; return Shapes.GrinderShapes.SHAPE_E;
case SOUTH: case SOUTH:

View file

@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.blocks.base;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/*
public class BlockFluidFlowing extends BlockFluidClassic implements ItemBlockBase.ICustomRarity { public class BlockFluidFlowing extends BlockFluidClassic implements ItemBlockBase.ICustomRarity {
public BlockFluidFlowing(Fluid fluid, Material material) { public BlockFluidFlowing(Fluid fluid, Material material) {
@ -31,3 +31,5 @@ public class BlockFluidFlowing extends BlockFluidClassic implements ItemBlockBas
return !world.getBlockState(pos).getMaterial().isLiquid() && super.displaceIfPossible(world, pos); return !world.getBlockState(pos).getMaterial().isLiquid() && super.displaceIfPossible(world, pos);
} }
} }
*/

View file

@ -123,6 +123,7 @@ public final class InitBooklet {
} }
private static void initChapters() { private static void initChapters() {
/*
//Getting Started //Getting Started
chaptersIntroduction[0] = new BookletChapter("bookTutorial", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyItems.ITEM_BOOKLET.get()), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3), new PageCrafting(4, ItemCrafting.recipeBook).setNoText()); chaptersIntroduction[0] = new BookletChapter("bookTutorial", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyItems.ITEM_BOOKLET.get()), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3), new PageCrafting(4, ItemCrafting.recipeBook).setNoText());
// chaptersIntroduction[1] = new BookletChapter("videoGuide", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc.get(), 1, TheMiscItems.YOUTUBE_ICON.ordinal()), new PageLinkButton(1, "https://www.youtube.com/watch?v=fhjz0Ew56pM"), new PageLinkButton(2, "https://www.youtube.com/playlist?list=PLJeFZ64pT89MrTRZYzD_rtHFajPVlt6cF")).setImportant(); // chaptersIntroduction[1] = new BookletChapter("videoGuide", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc.get(), 1, TheMiscItems.YOUTUBE_ICON.ordinal()), new PageLinkButton(1, "https://www.youtube.com/watch?v=fhjz0Ew56pM"), new PageLinkButton(2, "https://www.youtube.com/playlist?list=PLJeFZ64pT89MrTRZYzD_rtHFajPVlt6cF")).setImportant();
@ -294,5 +295,7 @@ public final class InitBooklet {
new BookletChapterTrials("empoweredOil", FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidEmpoweredOil, FluidAttributes.BUCKET_VOLUME)), false); new BookletChapterTrials("empoweredOil", FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidEmpoweredOil, FluidAttributes.BUCKET_VOLUME)), false);
new BookletChapterTrials("mobFarm", new ItemStack(Items.ROTTEN_FLESH), false); new BookletChapterTrials("mobFarm", new ItemStack(Items.ROTTEN_FLESH), false);
new BookletChapterTrials("empowererAutomation", new ItemStack(ActuallyBlocks.EMPOWERER.get()), false); new BookletChapterTrials("empowererAutomation", new ItemStack(ActuallyBlocks.EMPOWERER.get()), false);
*/
} }
} }

View file

@ -17,7 +17,6 @@ import de.ellpeck.actuallyadditions.mod.util.RefHelp;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import de.ellpeck.actuallyadditions.mod.util.crafting.BlankRecipe;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
@ -62,7 +61,7 @@ public class PageCrafting extends BookletPage {
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
GuiUtils.drawTexturedModalRect(startX + 5, startY + 6, 20, 0, 116, 54, 0); GuiUtils.drawTexturedModalRect(startX + 5, startY + 6, 20, 0, 116, 54, 0);
if (this.recipeTypeLocKey != null) { if (this.recipeTypeLocKey != null) {
@ -112,9 +111,12 @@ public class PageCrafting extends BookletPage {
ItemStack output = recipe.getResultItem(); ItemStack output = recipe.getResultItem();
if (StackUtil.isValid(output)) { if (StackUtil.isValid(output)) {
ItemStack copy = output.copy(); ItemStack copy = output.copy();
/*
if (this.isWildcard) { if (this.isWildcard) {
copy.setItemDamage(Util.WILDCARD); copy.setItemDamage(Util.WILDCARD);
} }
*/
list.add(copy); list.add(copy);
} }
} }
@ -126,7 +128,7 @@ public class PageCrafting extends BookletPage {
Ingredient[] ings = new Ingredient[9]; Ingredient[] ings = new Ingredient[9];
int width = 3; int width = 3;
int height = 3; int height = 3;
/*
if (recipe instanceof BlankRecipe) { if (recipe instanceof BlankRecipe) {
this.recipeTypeLocKey = "tooltip." + ActuallyAdditions.MODID + ".disabled"; this.recipeTypeLocKey = "tooltip." + ActuallyAdditions.MODID + ".disabled";
gui.addOrModifyItemRenderer(recipe.getResultItem(), startX + 100, startY + 25, 1F, false); gui.addOrModifyItemRenderer(recipe.getResultItem(), startX + 100, startY + 25, 1F, false);
@ -163,6 +165,8 @@ public class PageCrafting extends BookletPage {
this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapelessOreRecipe"; this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapelessOreRecipe";
} }
*/
for (int x = 0; x < width; x++) { for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) { for (int y = 0; y < height; y++) {
Ingredient ing = ings[y * width + x]; Ingredient ing = ings[y * width + x];
@ -173,10 +177,11 @@ public class PageCrafting extends BookletPage {
if (StackUtil.isValid(stack)) { if (StackUtil.isValid(stack)) {
ItemStack copy = stack.copy(); ItemStack copy = stack.copy();
copy.setCount(1); copy.setCount(1);
/*
if (copy.getItemDamage() == Util.WILDCARD) { if (copy.getItemDamage() == Util.WILDCARD) {
copy.setItemDamage(0); copy.setItemDamage(0);
} }
*/
gui.addOrModifyItemRenderer(copy, startX + 6 + x * 18, startY + 7 + y * 18, 1F, true); gui.addOrModifyItemRenderer(copy, startX + 6 + x * 18, startY + 7 + y * 18, 1F, true);
} }
} }

View file

@ -14,9 +14,7 @@ import java.io.File;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class ConfigurationHandler { public class ConfigurationHandler {