id
int64
22
34.9k
comment_id
int64
0
328
comment
stringlengths
2
2.55k
code
stringlengths
31
107k
classification
stringclasses
6 values
isFinished
bool
1 class
code_context_2
stringlengths
21
27.3k
code_context_10
stringlengths
29
27.3k
code_context_20
stringlengths
29
27.3k
24,418
5
//TODO: Print warning/error
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
IMPLEMENTATION
true
//If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer);
GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL);
if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer);
24,418
6
//Extract gas from dropper
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
NONSATD
true
} } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas
//We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) {
} if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); }
24,418
7
//If the dropper has fluid or the tank interacting with is already full of gas
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
NONSATD
true
} else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; }
if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) {
if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) {
24,418
8
//If we were able to actually extract it from the item, then insert it into our gas tank
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
NONSATD
true
GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error
if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } }
GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) {
24,418
9
//TODO: Print warning/error
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
IMPLEMENTATION
true
//If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer);
GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL);
if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer);
24,418
10
//Dump the tank
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
NONSATD
true
} } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); }
if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks
} } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) {
24,418
11
//It is actually an infusion tank
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
NONSATD
true
} } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point
//TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; }
return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty();
24,418
12
//TODO: Implement at some point
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
IMPLEMENTATION
true
//It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } }
((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY));
GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack));
24,418
13
//TODO: Handle other chemical tanks like maybe infusion tanks
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
IMPLEMENTATION
true
} } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank;
} else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) {
if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return;
24,418
14
//Dump the tank
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
NONSATD
true
} } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); }
if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks
} } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) {
24,418
15
//If something went wrong and we don't have a fluid handler on our tank, then fail
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
NONSATD
true
Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; }
IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) {
} //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount();
24,418
16
//TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
IMPLEMENTATION
true
IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; }
if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return;
return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item
24,418
17
//If something went wrong and we don't have a fluid tank fail
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
NONSATD
true
IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; }
return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount();
if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); }
24,418
18
//Insert fluid into dropper
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
NONSATD
true
return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return;
if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL);
} if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) {
24,418
19
//We are able to fit at least some of the fluid from our tank into the item
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
NONSATD
true
int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) {
} if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper
IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank
24,418
20
//If we were able to actually extract it from our tank, then insert it into the item
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
NONSATD
true
GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error
return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return;
if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error
24,418
21
//TODO: Print warning/error
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
IMPLEMENTATION
true
//If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer);
GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL);
if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer);
24,418
22
//Extract fluid from dropper
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
NONSATD
true
} } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return;
//We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank
} if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
24,418
23
//If we were able to actually extract it from the item, then insert it into our gas tank
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
NONSATD
true
GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error
if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } }
GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) {
24,418
24
//TODO: Print warning/error
public static void useDropper(PlayerEntity player, Object tank, int button) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } if (!stack.isEmpty()) { FluidStack storedFluid = StorageUtils.getStoredFluidFromNBT(stack); if (tank instanceof IChemicalTank) { IChemicalTank<?, ?> chemicalTank = (IChemicalTank<?, ?>) tank; if (chemicalTank.getEmptyStack() == GasStack.EMPTY) { //It is actually a gas tank IChemicalTank<Gas, GasStack> gasTank = (IChemicalTank<Gas, GasStack>) chemicalTank; Optional<IGasHandler> capability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (capability.isPresent()) { IGasHandler gasHandlerItem = capability.get(); if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 2) { //Dump the tank gasTank.setEmpty(); } } } else if (chemicalTank.getEmptyStack() == InfusionStack.EMPTY) { //It is actually an infusion tank IChemicalTank<InfuseType, InfusionStack> infusionTank = (IChemicalTank<InfuseType, InfusionStack>) chemicalTank; //TODO: Implement at some point } } //TODO: Handle other chemical tanks like maybe infusion tanks } else if (tank instanceof IExtendedFluidTank) { IExtendedFluidTank fluidTank = (IExtendedFluidTank) tank; if (!storedFluid.isEmpty() && !fluidTank.isEmpty() && !storedFluid.isFluidEqual(fluidTank.getFluid())) { return; } GasStack storedGas = GasStack.EMPTY; Optional<IGasHandler> gasCapability = MekanismUtils.toOptional(stack.getCapability(Capabilities.GAS_HANDLER_CAPABILITY)); if (gasCapability.isPresent()) { IGasHandler gasHandlerItem = gasCapability.get(); if (gasHandlerItem.getGasTankCount() > 0) { storedGas = gasHandlerItem.getGasInTank(0); } } if (button == 2) { //Dump the tank fluidTank.setEmpty(); } Optional<IFluidHandlerItem> capability = MekanismUtils.toOptional(FluidUtil.getFluidHandler(stack)); if (!capability.isPresent()) { //If something went wrong and we don't have a fluid handler on our tank, then fail return; } IFluidHandlerItem fluidHandlerItem = capability.get(); if (!(fluidHandlerItem instanceof IMekanismFluidHandler)) { //TODO: Decide if we want to support someone replacing our fluid handler with another? //If it isn't one of our fluid handlers fail return; } IExtendedFluidTank itemFluidTank = ((IMekanismFluidHandler) fluidHandlerItem).getFluidTank(0, null); if (itemFluidTank == null) { //If something went wrong and we don't have a fluid tank fail return; } if (button == 0) { //Insert fluid into dropper if (!storedGas.isEmpty() || fluidTank.isEmpty()) { return; } FluidStack fluidInTank = fluidTank.getFluid(); FluidStack simulatedRemainder = itemFluidTank.insert(fluidInTank, Action.SIMULATE, AutomationType.MANUAL); int remainder = simulatedRemainder.getAmount(); int amount = fluidInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the fluid from our tank into the item FluidStack extractedFluid = fluidTank.extract(amount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!extractedFluid.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!itemFluidTank.insert(extractedFluid, Action.EXECUTE, AutomationType.MANUAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract fluid from dropper if (!storedGas.isEmpty() || fluidTank.getNeeded() == 0) { return; } FluidStack simulatedRemainder = fluidTank.insert(storedFluid, Action.SIMULATE, AutomationType.MANUAL); int fluidInItemAmount = storedFluid.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < fluidInItemAmount) { FluidStack drainedGas = itemFluidTank.extract(fluidInItemAmount - remainder, Action.EXECUTE, AutomationType.MANUAL); if (!drainedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!fluidTank.insert(drainedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } } } }
IMPLEMENTATION
true
//If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer);
GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL);
if (gasHandlerItem.getGasTankCount() > 0) { //Validate something didn't go terribly wrong and we actually do have the tank we expect to have GasStack storedGas = gasHandlerItem.getGasInTank(0); if (!storedGas.isTypeEqual(gasTank.getStack())) { return; } if (button == 0) { //Insert gas into dropper if (!storedFluid.isEmpty() || gasTank.isEmpty()) { return; } GasStack gasInTank = gasTank.getStack(); GasStack simulatedRemainder = gasHandlerItem.insertGas(gasInTank, Action.SIMULATE); int remainder = simulatedRemainder.getAmount(); int amount = gasInTank.getAmount(); if (remainder < amount) { //We are able to fit at least some of the gas from our tank into the item GasStack extractedGas = gasTank.extract(amount - remainder, Action.EXECUTE, AutomationType.INTERNAL); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from our tank, then insert it into the item if (!gasHandlerItem.insertGas(extractedGas, Action.EXECUTE).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer); } } } else if (button == 1) { //Extract gas from dropper if (!storedFluid.isEmpty() || gasTank.getNeeded() == 0) { //If the dropper has fluid or the tank interacting with is already full of gas return; } GasStack simulatedRemainder = gasTank.insert(storedGas, Action.SIMULATE, AutomationType.INTERNAL); int gasInItemAmount = storedGas.getAmount(); int remainder = simulatedRemainder.getAmount(); if (remainder < gasInItemAmount) { GasStack extractedGas = gasHandlerItem.extractGas(0, gasInItemAmount - remainder, Action.EXECUTE); if (!extractedGas.isEmpty()) { //If we were able to actually extract it from the item, then insert it into our gas tank if (!gasTank.insert(extractedGas, Action.EXECUTE, AutomationType.INTERNAL).isEmpty()) { //TODO: Print warning/error } ((ServerPlayerEntity) player).sendContainerToPlayer(player.openContainer);
16,242
0
//GEN-FIRST:event_rhKeyReleased
private void rhKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_rhKeyReleased // calc_total(); // TODO add your handling code here: }
NONSATD
true
private void rhKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_rhKeyReleased // calc_total(); // TODO add your handling code here: }
private void rhKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_rhKeyReleased // calc_total(); // TODO add your handling code here: }
private void rhKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_rhKeyReleased // calc_total(); // TODO add your handling code here: }
16,242
1
// calc_total(); // TODO add your handling code here:
private void rhKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_rhKeyReleased // calc_total(); // TODO add your handling code here: }
IMPLEMENTATION
true
private void rhKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_rhKeyReleased // calc_total(); // TODO add your handling code here: }
private void rhKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_rhKeyReleased // calc_total(); // TODO add your handling code here: }
private void rhKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_rhKeyReleased // calc_total(); // TODO add your handling code here: }
16,243
0
//GEN-FIRST:event_riKeyReleased
private void riKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_riKeyReleased //calc_total(); // TODO add your handling code here: if (ri.isEnabled()==true){ calc_total(); }else{ } }
NONSATD
true
private void riKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_riKeyReleased //calc_total(); // TODO add your handling code here: if (ri.isEnabled()==true){
private void riKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_riKeyReleased //calc_total(); // TODO add your handling code here: if (ri.isEnabled()==true){ calc_total(); }else{ } }
private void riKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_riKeyReleased //calc_total(); // TODO add your handling code here: if (ri.isEnabled()==true){ calc_total(); }else{ } }
16,243
1
//calc_total(); // TODO add your handling code here:
private void riKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_riKeyReleased //calc_total(); // TODO add your handling code here: if (ri.isEnabled()==true){ calc_total(); }else{ } }
IMPLEMENTATION
true
private void riKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_riKeyReleased //calc_total(); // TODO add your handling code here: if (ri.isEnabled()==true){ calc_total();
private void riKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_riKeyReleased //calc_total(); // TODO add your handling code here: if (ri.isEnabled()==true){ calc_total(); }else{ } }
private void riKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_riKeyReleased //calc_total(); // TODO add your handling code here: if (ri.isEnabled()==true){ calc_total(); }else{ } }
8,062
0
// ObjectEventListener
@Override // ObjectEventListener public Object addingObject (Object obj, int index) { ObjectRenderer renderer = rendererFactory.newRenderer (obj); // TODO: VAADIN SESSION HANDLING layout.addComponent (renderer, index); active_renderers.put (get_object_hash (obj), renderer); log.info ("<<RENDERER>> addingObject() layout height = {} {}", layout.getHeight (), layout.getHeightUnits ().toString ()); log.info ("Add new renderer {}: obj={} or={} /// active_renderers={}", this, get_object_hash (obj), renderer, active_renderers); return (obj); }
NONSATD
true
@Override // ObjectEventListener public Object addingObject (Object obj, int index) {
@Override // ObjectEventListener public Object addingObject (Object obj, int index) { ObjectRenderer renderer = rendererFactory.newRenderer (obj); // TODO: VAADIN SESSION HANDLING layout.addComponent (renderer, index); active_renderers.put (get_object_hash (obj), renderer); log.info ("<<RENDERER>> addingObject() layout height = {} {}", layout.getHeight (), layout.getHeightUnits ().toString ()); log.info ("Add new renderer {}: obj={} or={} /// active_renderers={}", this, get_object_hash (obj), renderer, active_renderers); return (obj); }
@Override // ObjectEventListener public Object addingObject (Object obj, int index) { ObjectRenderer renderer = rendererFactory.newRenderer (obj); // TODO: VAADIN SESSION HANDLING layout.addComponent (renderer, index); active_renderers.put (get_object_hash (obj), renderer); log.info ("<<RENDERER>> addingObject() layout height = {} {}", layout.getHeight (), layout.getHeightUnits ().toString ()); log.info ("Add new renderer {}: obj={} or={} /// active_renderers={}", this, get_object_hash (obj), renderer, active_renderers); return (obj); }
8,062
1
// TODO: VAADIN SESSION HANDLING
@Override // ObjectEventListener public Object addingObject (Object obj, int index) { ObjectRenderer renderer = rendererFactory.newRenderer (obj); // TODO: VAADIN SESSION HANDLING layout.addComponent (renderer, index); active_renderers.put (get_object_hash (obj), renderer); log.info ("<<RENDERER>> addingObject() layout height = {} {}", layout.getHeight (), layout.getHeightUnits ().toString ()); log.info ("Add new renderer {}: obj={} or={} /// active_renderers={}", this, get_object_hash (obj), renderer, active_renderers); return (obj); }
IMPLEMENTATION
true
{ ObjectRenderer renderer = rendererFactory.newRenderer (obj); // TODO: VAADIN SESSION HANDLING layout.addComponent (renderer, index); active_renderers.put (get_object_hash (obj), renderer);
@Override // ObjectEventListener public Object addingObject (Object obj, int index) { ObjectRenderer renderer = rendererFactory.newRenderer (obj); // TODO: VAADIN SESSION HANDLING layout.addComponent (renderer, index); active_renderers.put (get_object_hash (obj), renderer); log.info ("<<RENDERER>> addingObject() layout height = {} {}", layout.getHeight (), layout.getHeightUnits ().toString ()); log.info ("Add new renderer {}: obj={} or={} /// active_renderers={}", this, get_object_hash (obj), renderer, active_renderers); return (obj); }
@Override // ObjectEventListener public Object addingObject (Object obj, int index) { ObjectRenderer renderer = rendererFactory.newRenderer (obj); // TODO: VAADIN SESSION HANDLING layout.addComponent (renderer, index); active_renderers.put (get_object_hash (obj), renderer); log.info ("<<RENDERER>> addingObject() layout height = {} {}", layout.getHeight (), layout.getHeightUnits ().toString ()); log.info ("Add new renderer {}: obj={} or={} /// active_renderers={}", this, get_object_hash (obj), renderer, active_renderers); return (obj); }
8,063
0
// ObjectEventListener
@Override // ObjectEventListener public void removingObject (Object obj, int index) { String hash = get_object_hash (obj); ObjectRenderer renderer = active_renderers.get (hash); log.info ("removingObject: obj={} or={} layout={} /// active_renderers={}", hash, renderer, layout, active_renderers); // Only deal with valid renderers if (renderer != null) { // TODO: VAADIN SESSION HANDLING layout.removeComponent (renderer); log.info ("<<RENDERER>> removingObject() layout height = {} {}", layout.getHeight (), layout.getHeightUnits ().toString ()); } active_renderers.remove (hash); }
NONSATD
true
@Override // ObjectEventListener public void removingObject (Object obj, int index) {
@Override // ObjectEventListener public void removingObject (Object obj, int index) { String hash = get_object_hash (obj); ObjectRenderer renderer = active_renderers.get (hash); log.info ("removingObject: obj={} or={} layout={} /// active_renderers={}", hash, renderer, layout, active_renderers); // Only deal with valid renderers if (renderer != null) { // TODO: VAADIN SESSION HANDLING layout.removeComponent (renderer);
@Override // ObjectEventListener public void removingObject (Object obj, int index) { String hash = get_object_hash (obj); ObjectRenderer renderer = active_renderers.get (hash); log.info ("removingObject: obj={} or={} layout={} /// active_renderers={}", hash, renderer, layout, active_renderers); // Only deal with valid renderers if (renderer != null) { // TODO: VAADIN SESSION HANDLING layout.removeComponent (renderer); log.info ("<<RENDERER>> removingObject() layout height = {} {}", layout.getHeight (), layout.getHeightUnits ().toString ()); } active_renderers.remove (hash); }
8,063
1
// Only deal with valid renderers
@Override // ObjectEventListener public void removingObject (Object obj, int index) { String hash = get_object_hash (obj); ObjectRenderer renderer = active_renderers.get (hash); log.info ("removingObject: obj={} or={} layout={} /// active_renderers={}", hash, renderer, layout, active_renderers); // Only deal with valid renderers if (renderer != null) { // TODO: VAADIN SESSION HANDLING layout.removeComponent (renderer); log.info ("<<RENDERER>> removingObject() layout height = {} {}", layout.getHeight (), layout.getHeightUnits ().toString ()); } active_renderers.remove (hash); }
NONSATD
true
ObjectRenderer renderer = active_renderers.get (hash); log.info ("removingObject: obj={} or={} layout={} /// active_renderers={}", hash, renderer, layout, active_renderers); // Only deal with valid renderers if (renderer != null) {
@Override // ObjectEventListener public void removingObject (Object obj, int index) { String hash = get_object_hash (obj); ObjectRenderer renderer = active_renderers.get (hash); log.info ("removingObject: obj={} or={} layout={} /// active_renderers={}", hash, renderer, layout, active_renderers); // Only deal with valid renderers if (renderer != null) { // TODO: VAADIN SESSION HANDLING layout.removeComponent (renderer); log.info ("<<RENDERER>> removingObject() layout height = {} {}", layout.getHeight (), layout.getHeightUnits ().toString ()); } active_renderers.remove (hash); }
@Override // ObjectEventListener public void removingObject (Object obj, int index) { String hash = get_object_hash (obj); ObjectRenderer renderer = active_renderers.get (hash); log.info ("removingObject: obj={} or={} layout={} /// active_renderers={}", hash, renderer, layout, active_renderers); // Only deal with valid renderers if (renderer != null) { // TODO: VAADIN SESSION HANDLING layout.removeComponent (renderer); log.info ("<<RENDERER>> removingObject() layout height = {} {}", layout.getHeight (), layout.getHeightUnits ().toString ()); } active_renderers.remove (hash); }
8,063
2
// TODO: VAADIN SESSION HANDLING
@Override // ObjectEventListener public void removingObject (Object obj, int index) { String hash = get_object_hash (obj); ObjectRenderer renderer = active_renderers.get (hash); log.info ("removingObject: obj={} or={} layout={} /// active_renderers={}", hash, renderer, layout, active_renderers); // Only deal with valid renderers if (renderer != null) { // TODO: VAADIN SESSION HANDLING layout.removeComponent (renderer); log.info ("<<RENDERER>> removingObject() layout height = {} {}", layout.getHeight (), layout.getHeightUnits ().toString ()); } active_renderers.remove (hash); }
IMPLEMENTATION
true
if (renderer != null) { // TODO: VAADIN SESSION HANDLING layout.removeComponent (renderer); log.info ("<<RENDERER>> removingObject() layout height = {} {}", layout.getHeight (), layout.getHeightUnits ().toString ());
@Override // ObjectEventListener public void removingObject (Object obj, int index) { String hash = get_object_hash (obj); ObjectRenderer renderer = active_renderers.get (hash); log.info ("removingObject: obj={} or={} layout={} /// active_renderers={}", hash, renderer, layout, active_renderers); // Only deal with valid renderers if (renderer != null) { // TODO: VAADIN SESSION HANDLING layout.removeComponent (renderer); log.info ("<<RENDERER>> removingObject() layout height = {} {}", layout.getHeight (), layout.getHeightUnits ().toString ()); } active_renderers.remove (hash); }
@Override // ObjectEventListener public void removingObject (Object obj, int index) { String hash = get_object_hash (obj); ObjectRenderer renderer = active_renderers.get (hash); log.info ("removingObject: obj={} or={} layout={} /// active_renderers={}", hash, renderer, layout, active_renderers); // Only deal with valid renderers if (renderer != null) { // TODO: VAADIN SESSION HANDLING layout.removeComponent (renderer); log.info ("<<RENDERER>> removingObject() layout height = {} {}", layout.getHeight (), layout.getHeightUnits ().toString ()); } active_renderers.remove (hash); }
24,462
0
// FIXME [VISTALL] support other borders?
private void bordersChanged() { JComponent component = (JComponent)toAWTComponent(); component.setBorder(JBUI.Borders.empty()); Collection<BorderInfo> borders = dataObject().getBorders(); Map<BorderPosition, Integer> emptyBorders = new LinkedHashMap<>(); for (BorderInfo border : borders) { if (border.getBorderStyle() == BorderStyle.EMPTY) { emptyBorders.put(border.getBorderPosition(), border.getWidth()); } } if (!emptyBorders.isEmpty()) { component.setBorder(JBUI.Borders.empty(getBorderSize(emptyBorders, BorderPosition.TOP), getBorderSize(emptyBorders, BorderPosition.LEFT), getBorderSize(emptyBorders, BorderPosition.BOTTOM), getBorderSize(emptyBorders, BorderPosition.RIGHT))); return; } // FIXME [VISTALL] support other borders? }
DEFECT
true
return; } // FIXME [VISTALL] support other borders? }
for (BorderInfo border : borders) { if (border.getBorderStyle() == BorderStyle.EMPTY) { emptyBorders.put(border.getBorderPosition(), border.getWidth()); } } if (!emptyBorders.isEmpty()) { component.setBorder(JBUI.Borders.empty(getBorderSize(emptyBorders, BorderPosition.TOP), getBorderSize(emptyBorders, BorderPosition.LEFT), getBorderSize(emptyBorders, BorderPosition.BOTTOM), getBorderSize(emptyBorders, BorderPosition.RIGHT))); return; } // FIXME [VISTALL] support other borders? }
private void bordersChanged() { JComponent component = (JComponent)toAWTComponent(); component.setBorder(JBUI.Borders.empty()); Collection<BorderInfo> borders = dataObject().getBorders(); Map<BorderPosition, Integer> emptyBorders = new LinkedHashMap<>(); for (BorderInfo border : borders) { if (border.getBorderStyle() == BorderStyle.EMPTY) { emptyBorders.put(border.getBorderPosition(), border.getWidth()); } } if (!emptyBorders.isEmpty()) { component.setBorder(JBUI.Borders.empty(getBorderSize(emptyBorders, BorderPosition.TOP), getBorderSize(emptyBorders, BorderPosition.LEFT), getBorderSize(emptyBorders, BorderPosition.BOTTOM), getBorderSize(emptyBorders, BorderPosition.RIGHT))); return; } // FIXME [VISTALL] support other borders? }
8,111
0
//TODO refactor operations according to the protocol message
public synchronized void start() throws IOException, InterruptedException { final AtomicBoolean bound = new AtomicBoolean(); running.set(true); Thread t = new Thread(new Runnable() { @Override public void run() { try { ServerSocket ss = new ServerSocket(port); synchronized (bound) { bound.set(true); bound.notifyAll(); } Socket[] conn = new Socket[nDataGens]; try { for (int i = 0; i < nDataGens; i++) { conn[i] = ss.accept(); } for (int n = 0; n < nIntervals; ++n) { //TODO refactor operations according to the protocol message if (flagStopResume) { for (int i = 0; i < nDataGens; i++) { receiveStopped(conn[i]); } protocolActions[n].perform(); if (n != nIntervals - 1) { for (int i = 0; i < nDataGens; i++) { sendResume(conn[i]); } } } else { for (int i = 0; i < nDataGens; i++) { receiveReached(conn[i]); } protocolActions[n].perform(); } } } finally { for (int i = 0; i < conn.length; ++i) { if (conn[i] != null) { conn[i].close(); } } ss.close(); } running.set(false); synchronized (OrchestratorServer.this) { OrchestratorServer.this.notifyAll(); } } catch (Throwable t) { t.printStackTrace(); } } }); t.start(); synchronized (bound) { while (!bound.get()) { bound.wait(); } } }
DESIGN
true
} for (int n = 0; n < nIntervals; ++n) { //TODO refactor operations according to the protocol message if (flagStopResume) { for (int i = 0; i < nDataGens; i++) {
synchronized (bound) { bound.set(true); bound.notifyAll(); } Socket[] conn = new Socket[nDataGens]; try { for (int i = 0; i < nDataGens; i++) { conn[i] = ss.accept(); } for (int n = 0; n < nIntervals; ++n) { //TODO refactor operations according to the protocol message if (flagStopResume) { for (int i = 0; i < nDataGens; i++) { receiveStopped(conn[i]); } protocolActions[n].perform(); if (n != nIntervals - 1) { for (int i = 0; i < nDataGens; i++) { sendResume(conn[i]); } }
public synchronized void start() throws IOException, InterruptedException { final AtomicBoolean bound = new AtomicBoolean(); running.set(true); Thread t = new Thread(new Runnable() { @Override public void run() { try { ServerSocket ss = new ServerSocket(port); synchronized (bound) { bound.set(true); bound.notifyAll(); } Socket[] conn = new Socket[nDataGens]; try { for (int i = 0; i < nDataGens; i++) { conn[i] = ss.accept(); } for (int n = 0; n < nIntervals; ++n) { //TODO refactor operations according to the protocol message if (flagStopResume) { for (int i = 0; i < nDataGens; i++) { receiveStopped(conn[i]); } protocolActions[n].perform(); if (n != nIntervals - 1) { for (int i = 0; i < nDataGens; i++) { sendResume(conn[i]); } } } else { for (int i = 0; i < nDataGens; i++) { receiveReached(conn[i]); } protocolActions[n].perform(); } } } finally { for (int i = 0; i < conn.length; ++i) { if (conn[i] != null) {
24,503
0
//When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST);
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap);
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap);
24,503
1
//Initialize the wheels
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu
//*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart();
24,503
2
//Initialize the imu
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
//Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors
autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L;
24,503
3
//Initialize the color sensors
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
//Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors
autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString());
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) {
24,503
4
//Initialize the digitalTouch sensors
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
//Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights
targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update();
//When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON
24,503
5
//Initialize the LED lights
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
//Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors
autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX();
//and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders
24,503
6
//Initialize the Rev2mDistance Sensors
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
//Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads
//Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart();
//*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading)
24,503
7
//Prepare the expansion hubs for bulk reads
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
//Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString());
//Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L;
autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose);
24,503
8
//EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders
telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions();
//Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop();
24,503
9
//Perform the transitional actions //Initialize the encoders
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading)
Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong");
robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL;
24,503
10
//Set the target pose (where the robot should drive to + heading)
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
//Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose);
waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); }
//Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state
24,503
11
//Set the new state
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions();
switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) {
telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry
24,503
12
//check if trigger event occurred
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions
stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch);
while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL:
24,503
13
//Perform transitional actions
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state
autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString());
case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions
24,503
14
//Set the new state
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions();
switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) {
telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry
24,503
15
//set a timelimit of 5 seconds for next state
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions
} break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update();
//Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose);
24,503
16
//Perform the state actions
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry
case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break;
robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state
24,503
17
//Report telemetry
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
//Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount()));
| stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event?
//Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions();
24,503
18
//trigger event?
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm
//Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions();
| stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions
24,503
19
//Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions();
autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString());
case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field
24,503
20
//Set the new state
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions();
switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) {
telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry
24,503
21
//perform the state actions
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString());
//Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop();
telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount()));
24,503
22
//TBD code to place the wobble goal
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
IMPLEMENTATION
true
standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit);
//TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher
telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString());
24,503
23
//trigger event?
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm
//Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions();
| stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions
24,503
24
//or timed out?
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop();
autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry
case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event?
24,503
25
//Perform transitional actions
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state
autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString());
case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions
24,503
26
//TBD spin up the ring launcher //Set the new state
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
//Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions();
//TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString());
//TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose);
24,503
27
//perform the state actions
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString());
//Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop();
telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount()));
24,503
28
//Report telemetry
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
//Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount()));
| stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event?
//Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions();
24,503
29
//trigger event?
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm
//Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions();
| stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions
24,503
30
//Create a new target pose on the launch line in center of field
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
//Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0);
telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString());
//Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state
24,503
31
//Set the new state
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions();
switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) {
telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry
24,503
32
//perform state actions
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString());
case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch);
robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; }
24,503
33
//TBD action to launch rings at powershots
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit);
if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry
//Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } }
24,503
34
//check for trigger event
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions
//Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update();
telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) {
24,503
35
//perform state actions
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString());
case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch);
robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; }
24,503
36
//Report telemetry
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
//Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount()));
| stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event?
//Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions();
24,503
37
//Exit opmode
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
} } //Exit opmode robot.stop(); //State debug info
telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // }
telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
24,503
38
//State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // }
@Override public void runOpMode(){ //When the robot begins, it is in initialized state //In this state, initialize the robot sensors and actuators //and wait for the event: driver pushes START //************************************************************ //*** INITIALIZE THE ROBOT //************************************************************ autonParameters = AutonParameters.DEBUG_TWO_WHEEL; autonParameters.setSpeed(Speed.FAST); autonParameters.getSpeed().setK_i(0.3); robot = new Robot(Pose.PresetPose.INNER_START_LINE, Alliance.RED, autonParameters); targetZone = new TargetZone(robot.getAlliance(),TargetZone.Zone.B); launchLine = new LaunchLine(); autonState = AutonState.INITIALIZE; stateStopWatch = new StopWatch(); //Initialize the wheels robot.initializeStandardDriveWheels(hardwareMap); //Initialize the imu robot.initializeImu(hardwareMap); //Initialize the color sensors robot.initializeColorSensors(hardwareMap); //Initialize the digitalTouch sensors robot.initializeEbotsDigitalTouches(hardwareMap); //Initialize the LED lights robot.initializeRevBlinkinLedDriver(hardwareMap); //Initialize the Rev2mDistance Sensors robot.initializeEbotsRev2mDistanceSensors(hardwareMap); //Prepare the expansion hubs for bulk reads robot.initializeExpansionHubsForBulkRead(hardwareMap); telemetry.addLine(robot.getActualPose().toString()); telemetry.addLine("Initialization Complete!"); telemetry.update(); Pose newPose = robot.getActualPose(); newPose.getX(); robot.setTargetPose(newPose); waitForStart(); telemetry.clearAll(); long stateTimeLimit = 0L; while(opModeIsActive()){ switch (autonState) { case INITIALIZE: if (this.isStarted()) { //EVENT TO TRIGGER NEXT STATE IS PUSHING START BUTTON //Perform the transitional actions //Initialize the encoders robot.initializeEncoderTrackers(autonParameters); //Set the target pose (where the robot should drive to + heading) Pose targetPose = new Pose(targetZone.getFieldPosition(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_TARGET_ZONE; standardStateTransitionActions(); } else { telemetry.addLine("Stuck in INITIALIZED state, something is wrong"); telemetry.update(); } break; case MOVE_TO_TARGET_ZONE: if (robot.getEbotsMotionController().isTargetPoseReached(robot) //check if trigger event occurred | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit) { //Perform transitional actions robot.stop(); //Set the new state autonState = AutonState.PLACE_WOBBLE_GOAL; standardStateTransitionActions(); stateTimeLimit = 5000; //set a timelimit of 5 seconds for next state } else { //Perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case PLACE_WOBBLE_GOAL: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? //Perform transitional actions //TBD code to fold Wobble Arm //Create a new target pose on the launch line in center of field double xCoord = launchLine.getX()-(robot.getSizeCoordinate(CsysDirection.X)/2); Pose targetPose = new Pose(xCoord, robot.getActualPose().getY(), 0); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.MOVE_TO_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform the state actions //TBD code to place the wobble goal telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case MOVE_TO_LAUNCH_LINE: if(robot.getEbotsMotionController().isTargetPoseReached(robot) //trigger event? | stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //or timed out? //Perform transitional actions robot.stop(); //TBD spin up the ring launcher //Set the new state autonState = AutonState.SHOOT_POWER_SHOTS; standardStateTransitionActions(); stateTimeLimit = 5000L; } else { //perform the state actions robot.getEbotsMotionController().moveToTargetPose(robot,stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; case SHOOT_POWER_SHOTS: if(stateStopWatch.getElapsedTimeMillis() > stateTimeLimit){ //trigger event? robot.stop(); //Create a new target pose on the launch line in center of field Pose targetPose = new Pose(launchLine.getX(), robot.getActualPose().getY(), 180); robot.setTargetPose(targetPose); stateTimeLimit = robot.getEbotsMotionController().calculateTimeLimitMillis(robot); //Set the new state autonState = AutonState.PARK_ON_LAUNCH_LINE; standardStateTransitionActions(); } else { //perform state actions //TBD action to launch rings at powershots telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString() + " time limit " + stateTimeLimit); } break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
NONSATD
true
//Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
} break; case PARK_ON_LAUNCH_LINE: if(!opModeIsActive()){ //check for trigger event robot.stop(); } else { //perform state actions robot.getEbotsMotionController().moveToTargetPose(robot, stateStopWatch); //Report telemetry telemetry.addData("Current State", autonState.toString()); telemetry.addLine(stateStopWatch.toString(robot.getEbotsMotionController().getLoopCount())); telemetry.addData("Actual Pose: ", robot.getActualPose().toString()); telemetry.addData("Target Pose: ", robot.getTargetPose().toString()); telemetry.addData("Error: ", robot.getPoseError().toString()); telemetry.update(); } break; } } //Exit opmode robot.stop(); //State debug info // if (debugOn) { // Log.d(logTag, "Transitioning out of state " + autonState.toString()); // if (robot.getEbotsMotionController().isTargetPoseReached(robot)) { // Log.d(logTag, "Pose Achieved in " + format("%.2f", stateStopWatch.getElapsedTimeSeconds())); // } else { // Log.d(logTag, "Failed to reach target, timed out!!! " + robot.getPoseError().toString()); // } // } }
16,325
0
//GEN-FIRST:event_orderButtonActionPerformed
private void orderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orderButtonActionPerformed AddOrderForm orderForm = AddOrderForm.getInstance(); System.out.println(lowOnStock.get(stockTable.getSelectedColumn())); AdminMainForm admin = AdminMainForm.getInstance(); admin.showForm(orderForm); orderForm.setDrug(lowOnStock.get(stockTable.getSelectedRow())); //orderForm.setVisible(true);// TODO add your handling code here: }
NONSATD
true
private void orderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orderButtonActionPerformed AddOrderForm orderForm = AddOrderForm.getInstance(); System.out.println(lowOnStock.get(stockTable.getSelectedColumn()));
private void orderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orderButtonActionPerformed AddOrderForm orderForm = AddOrderForm.getInstance(); System.out.println(lowOnStock.get(stockTable.getSelectedColumn())); AdminMainForm admin = AdminMainForm.getInstance(); admin.showForm(orderForm); orderForm.setDrug(lowOnStock.get(stockTable.getSelectedRow())); //orderForm.setVisible(true);// TODO add your handling code here: }
private void orderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orderButtonActionPerformed AddOrderForm orderForm = AddOrderForm.getInstance(); System.out.println(lowOnStock.get(stockTable.getSelectedColumn())); AdminMainForm admin = AdminMainForm.getInstance(); admin.showForm(orderForm); orderForm.setDrug(lowOnStock.get(stockTable.getSelectedRow())); //orderForm.setVisible(true);// TODO add your handling code here: }
16,325
1
//orderForm.setVisible(true);// TODO add your handling code here:
private void orderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orderButtonActionPerformed AddOrderForm orderForm = AddOrderForm.getInstance(); System.out.println(lowOnStock.get(stockTable.getSelectedColumn())); AdminMainForm admin = AdminMainForm.getInstance(); admin.showForm(orderForm); orderForm.setDrug(lowOnStock.get(stockTable.getSelectedRow())); //orderForm.setVisible(true);// TODO add your handling code here: }
IMPLEMENTATION
true
admin.showForm(orderForm); orderForm.setDrug(lowOnStock.get(stockTable.getSelectedRow())); //orderForm.setVisible(true);// TODO add your handling code here: }
private void orderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orderButtonActionPerformed AddOrderForm orderForm = AddOrderForm.getInstance(); System.out.println(lowOnStock.get(stockTable.getSelectedColumn())); AdminMainForm admin = AdminMainForm.getInstance(); admin.showForm(orderForm); orderForm.setDrug(lowOnStock.get(stockTable.getSelectedRow())); //orderForm.setVisible(true);// TODO add your handling code here: }
private void orderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orderButtonActionPerformed AddOrderForm orderForm = AddOrderForm.getInstance(); System.out.println(lowOnStock.get(stockTable.getSelectedColumn())); AdminMainForm admin = AdminMainForm.getInstance(); admin.showForm(orderForm); orderForm.setDrug(lowOnStock.get(stockTable.getSelectedRow())); //orderForm.setVisible(true);// TODO add your handling code here: }
16,343
0
// @formatter:off /////////////////// /// Air /// ///////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS)
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get())
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"),
16,343
1
/////////////////// /// Stone /// ///////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS)
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get())
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"),
16,343
2
/////////////////// /// Grass /// ///////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS)
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get())
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"),
16,343
3
/////////////////// /// Dirt /// ///////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS)
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get())
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"),
16,343
4
/////////////////// /// Cobblestone /// ///////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS)
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get())
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"),
16,343
5
/////////////////// /// Planks /// ///////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS)
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get())
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"),
16,343
6
//////////////////// /// Sapling /// ////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
.build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE)
) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) )
.build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type);
16,343
7
//////////////////// /// Bedrock /// ////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
.build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE)
) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) )
.build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type);
16,343
8
//////////////////// /// Sand /// ////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
.build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE)
) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) )
.build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type);
16,343
9
// TODO: Sand physics behavior //////////////////// /// Gravel /// ////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
IMPLEMENTATION
true
.build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType()
.keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore ///
.add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore ///
16,343
10
// TODO: Gravel physics behavior //////////////////// /// Gold Ore /// ////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
IMPLEMENTATION
true
.translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType()
//////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// ////////////////////
.register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// ////////////////////
16,343
11
//////////////////// /// Iron Ore /// ////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
.build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE)
) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) )
.build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type);
16,343
12
//////////////////// /// Coal Ore /// ////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
.build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE)
) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) )
.build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type);
16,343
13
//////////////////// /// Log 1 /// ////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
.build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE)
) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) )
.build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type);
16,343
14
//////////////////// /// Leaves 1 /// ////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
.build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE)
) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) )
.build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type);
16,343
15
//////////////////// /// Sponge /// ////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
.build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE)
) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) )
.build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type);
16,343
16
//////////////////// /// Glass /// ////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
.build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE)
) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) )
.build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type);
16,343
17
//////////////////// /// Lapis Ore /// ////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
.build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE)
) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) )
.build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type);
16,343
18
//////////////////// /// Lapis Block /// ////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
.build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE)
) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) )
.build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type);
16,343
19
//////////////////// /// Dispenser /// ////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
.build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE)
) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) )
.build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type);
16,343
20
// .tileEntityType(() -> TileEntityTypes.DISPENSER)
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
.add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline
//////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data;
//////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT)
16,343
21
//////////////////// /// Sandstone /// ////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
.build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE)
) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) )
.build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type);
16,343
22
//////////////////// /// Noteblock /// ////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
.build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE)
) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) )
.build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type);
16,343
23
//////////////////// /// Bed /// ////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
.build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE)
) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) )
.build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type);
16,343
24
////////////////////// /// Golden Rail /// //////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED)
facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7))
.withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; });
16,343
25
//////////////////////// /// Detector Rail /// ////////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED)
.add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7))
register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; });
16,343
26
// TODO: 29 /////////////// /// Web /// ///////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
IMPLEMENTATION
true
return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType()
.add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass ///
register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder
16,343
27
////////////////////// /// Tall Grass /// //////////////////////
@Override public void registerDefaults() { // @formatter:off /////////////////// /// Air /// /////////////////// register(0, builder() .properties(PropertyProviderCollections.DEFAULT_GAS) .translation("tile.air.name") .build("minecraft", "air")); /////////////////// /// Stone /// /////////////////// register(1, simpleBuilder() .trait(LanternEnumTraits.STONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.STONE_TYPE, LanternStoneType.STONE).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.STONE_TYPE, LanternStoneType.STONE) ) ) .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(30.0))) .translation(TranslationProvider.of(LanternEnumTraits.STONE_TYPE)) .build("minecraft", "stone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.STONE_TYPE).get().getInternalId()); /////////////////// /// Grass /// /////////////////// register(2, simpleBuilder() .trait(LanternBooleanTraits.SNOWY) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .defaultState(state -> state.withTrait(LanternBooleanTraits.SNOWY, false).get()) .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.grass.name") .build("minecraft", "grass")); /////////////////// /// Dirt /// /////////////////// register(3, simpleBuilder() .traits(LanternEnumTraits.DIRT_TYPE, LanternBooleanTraits.SNOWY) .defaultState(state -> state .withTrait(LanternEnumTraits.DIRT_TYPE, LanternDirtType.DIRT).get() .withTrait(LanternBooleanTraits.SNOWY, false).get()) .extendedStateProvider(new SnowyExtendedBlockStateProvider()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.DIRT_TYPE, LanternDirtType.DIRT) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.DIRT_TYPE)) .build("minecraft", "dirt"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.DIRT_TYPE).get().getInternalId()); /////////////////// /// Cobblestone /// /////////////////// register(4, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(3.0))) .translation("tile.stonebrick.name") .build("minecraft", "cobblestone")); /////////////////// /// Planks /// /////////////////// register(5, simpleBuilder() .trait(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0)) .add(flammableInfo(5, 20))) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.planks." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "planks"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); //////////////////// /// Sapling /// //////////////////// register(6, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE, LanternIntegerTraits.SAPLING_GROWTH_STAGE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get() .withTrait(LanternIntegerTraits.SAPLING_GROWTH_STAGE, 0).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.sapling." + type.getTranslationKeyBase() + ".name"))) .build("minecraft", "sapling"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int stage = blockState.getTraitValue(LanternIntegerTraits.SAPLING_GROWTH_STAGE).get(); return (byte) (stage << 3 | type); }); //////////////////// /// Bedrock /// //////////////////// register(7, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.bedrock.name") .build("minecraft", "bedrock")); //////////////////// /// Sand /// //////////////////// register(12, simpleBuilder() .trait(LanternEnumTraits.SAND_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SAND_TYPE, LanternSandType.NORMAL).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SAND_TYPE, LanternSandType.NORMAL) ) ) .properties(builder -> builder .add(hardness(0.5)) .add(blastResistance(2.5))) .translation(TranslationProvider.of(LanternEnumTraits.SAND_TYPE)) .build("minecraft", "sand"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SAND_TYPE).get().getInternalId()); // TODO: Sand physics behavior //////////////////// /// Gravel /// //////////////////// register(13, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation("tile.gravel.name") .build("minecraft", "gravel")); // TODO: Gravel physics behavior //////////////////// /// Gold Ore /// //////////////////// register(14, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreGold.name") .build("minecraft", "gold_ore")); //////////////////// /// Iron Ore /// //////////////////// register(15, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreIron.name") .build("minecraft", "iron_ore")); //////////////////// /// Coal Ore /// //////////////////// register(16, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreCoal.name") .build("minecraft", "coal_ore")); //////////////////// /// Log 1 /// //////////////////// register(17, logBuilder(LanternEnumTraits.LOG1_TYPE, LanternTreeType.OAK) .build("minecraft", "log"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG1_TYPE).get().getInternalId())); //////////////////// /// Leaves 1 /// //////////////////// register(18, leavesBuilder(LanternEnumTraits.LEAVES1_TYPE, LanternTreeType.OAK) .build("minecraft", "leaves"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES1_TYPE).get().getInternalId())); //////////////////// /// Sponge /// //////////////////// register(19, simpleBuilder() .trait(LanternBooleanTraits.IS_WET) .defaultState(state -> state.withTrait(LanternBooleanTraits.IS_WET, false).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.IS_WET, false) ) ) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .translation(new SpongeTranslationProvider()) .build("minecraft", "sponge"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.IS_WET).get() ? 1 : 0)); //////////////////// /// Glass /// //////////////////// register(20, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .translation("tile.glass.name") .build("minecraft", "glass")); //////////////////// /// Lapis Ore /// //////////////////// register(21, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.oreLapis.name") .build("minecraft", "lapis_ore")); //////////////////// /// Lapis Block /// //////////////////// register(22, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.blockLapis.name") .build("minecraft", "lapis_block")); //////////////////// /// Dispenser /// //////////////////// register(23, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DISPENSER) .translation("tile.dispenser.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dispenser"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); //////////////////// /// Sandstone /// //////////////////// register(24, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); //////////////////// /// Noteblock /// //////////////////// register(25, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation("tile.musicBlock.name") .tileEntityType(() -> TileEntityTypes.NOTE) .behaviors(pipeline -> pipeline .add(new NoteBlockInteractionBehavior())) .build("minecraft", "noteblock")); //////////////////// /// Bed /// //////////////////// register(26, simpleBuilder() .traits(LanternEnumTraits.HORIZONTAL_FACING, LanternEnumTraits.BED_PART, LanternBooleanTraits.OCCUPIED) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get() .withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); //////////////////////// /// Detector Rail /// //////////////////////// register(28, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.detectorRail.name") .build("minecraft", "detector_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; }); // TODO: 29 /////////////// /// Web /// /////////////// register(30, simpleBuilder() .itemType() .properties(builder -> builder .add(PASSABLE) .add(hardness(4.0)) .add(blastResistance(20.0))) .translation("tile.web.name") .build("minecraft", "web")); ////////////////////// /// Tall Grass /// ////////////////////// register(31, simpleBuilder() .traits(LanternEnumTraits.SHRUB_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.SHRUB_TYPE, LanternShrubType.DEAD_BUSH).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SHRUB_TYPE, LanternShrubType.DEAD_BUSH))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .translation("tile.tallgrass.name") .build("minecraft", "tallgrass"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SHRUB_TYPE).get().getInternalId()); ///////////////////// /// Dead Bush /// ///////////////////// register(32, simpleBuilder() .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(replaceable(true))) .selectionBox(BoundingBoxes.bush()) .itemType() .translation("tile.deadbush.name") .build("minecraft", "deadbush")); // TODO: 33 // TODO: 34 /////////////////// /// Wool /// /////////////////// register(35, dyedBuilder("tile.wool.%s.name") .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .build("minecraft", "wool"), this::dyedData); // TODO: 36 ///////////////////////// /// Yellow Flower /// ///////////////////////// register(37, simpleBuilder() .traits(LanternEnumTraits.YELLOW_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.YELLOW_FLOWER_TYPE, LanternPlantType.DANDELION).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.DANDELION))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.YELLOW_FLOWER_TYPE)) .build("minecraft", "yellow_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.YELLOW_FLOWER_TYPE).get().getInternalId()); ////////////////////// /// Red Flower /// ////////////////////// register(38, simpleBuilder() .traits(LanternEnumTraits.RED_FLOWER_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.RED_FLOWER_TYPE, LanternPlantType.POPPY).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.PLANT_TYPE, LanternPlantType.POPPY))) .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation(TranslationProvider.of(LanternEnumTraits.RED_FLOWER_TYPE)) .build("minecraft", "red_flower"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.RED_FLOWER_TYPE).get().getInternalId()); ////////////////////////// /// Brown Mushroom /// ////////////////////////// register(39, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE) .add(lightEmission(1))) .translation("tile.mushroom.name") .build("minecraft", "brown_mushroom")); //////////////////////// /// Red Mushroom /// //////////////////////// register(40, simpleBuilder() .selectionBox(BoundingBoxes.bush()) .properties(builder -> builder .add(INSTANT_BROKEN) .add(PASSABLE)) .translation("tile.mushroom.name") .build("minecraft", "red_mushroom")); ////////////////////// /// Gold Block /// ////////////////////// register(41, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(10.0))) .translation("tile.blockGold.name") .build("minecraft", "gold_block")); ////////////////////// /// Iron Block /// ////////////////////// register(42, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockIron.name") .build("minecraft", "iron_block")); /////////////////////////// /// Double Stone Slab 1 /// /////////////////////////// register(43, doubleStoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE) .translation("tile.stoneSlab.name") .build("minecraft", "double_stone_slab"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); //////////////////////// /// Stone Slab 1 /// //////////////////////// register(44, stoneSlab(LanternEnumTraits.STONE_SLAB1_TYPE, LanternSlabType.STONE, () -> BlockTypes.STONE_SLAB, () -> BlockTypes.DOUBLE_STONE_SLAB) .translation("tile.stoneSlab.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB1_TYPE).get().getInternalId())); /////////////////////// /// Brick Block /// /////////////////////// register(45, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.brick.name") .build("minecraft", "brick_block")); /////////////// /// TNT /// /////////////// register(46, simpleBuilder() .trait(LanternBooleanTraits.EXPLODE) .defaultState(state -> state .withTrait(LanternBooleanTraits.EXPLODE, false).get()) .itemType() .properties(builder -> builder .add(INSTANT_BROKEN)) .translation("tile.tnt.name") .build("minecraft", "tnt"), blockState -> (byte) (blockState.getTraitValue(LanternBooleanTraits.EXPLODE).get() ? 1 : 0)); ///////////////////// /// Bookshelf /// ///////////////////// register(47, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(1.5)) .add(blastResistance(7.5))) .translation("tile.bookshelf.name") .build("minecraft", "bookshelf")); ///////////////////////////// /// Mossy Cobblestone /// ///////////////////////////// register(48, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .translation("tile.stoneMoss.name") .build("minecraft", "mossy_cobblestone")); //////////////////// /// Obsidian /// //////////////////// register(49, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(50.0)) .add(blastResistance(2000.0))) .translation("tile.obsidian.name") .build("minecraft", "obsidian")); ///////////////// /// Torch /// ///////////////// register(50, builder() .trait(LanternEnumTraits.TORCH_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.TORCH_FACING, Direction.UP).get()) .itemType() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .translation("tile.torch.name") .selectionBox(BoundingBoxes::torch) .behaviors(pipeline -> pipeline .add(new BlockSnapshotProviderPlaceBehavior()) .add(new TorchPlacementBehavior()) .add(new SimpleBreakBehavior())) .build("minecraft", "torch"), blockState -> { final Direction direction = blockState.getTraitValue(LanternEnumTraits.TORCH_FACING).get(); switch (direction) { case EAST: return (byte) 1; case WEST: return (byte) 2; case SOUTH: return (byte) 3; case NORTH: return (byte) 4; case UP: return (byte) 5; default: throw new IllegalArgumentException(); } }); ////////////// /// Fire /// ////////////// register(51, simpleBuilder() .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN) .add(lightEmission(15))) .collisionBox(BoundingBoxes.NULL) .translation("tile.fire.name") .build("minecraft", "fire")); ///////////////////// /// Mob Spawner /// ///////////////////// register(52, simpleBuilder() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(25.0))) .translation("tile.mobSpawner.name") .build("minecraft", "mob_spawner")); // TODO: Oak Stairs //////////////////// /// Chest /// //////////////////// register(54, chestBuilder() .translation("tile.chest.name") .build("minecraft", "chest"), this::horizontalFacingData); /////////////////////////// /// Redstone Wire /// /////////////////////////// register(55, simpleBuilder() .traits(LanternIntegerTraits.POWER) .selectionBox(new AABB(0, 0, 0, 1.0, 0.0625, 1.0)) // TODO: Based on connections .properties(builder -> builder .add(PASSABLE) .add(INSTANT_BROKEN)) .defaultState(state -> state .withTrait(LanternIntegerTraits.POWER, 0).get()) .translation("tile.redstoneDust.name") .build("minecraft", "redstone_wire"), state -> state.get(Keys.POWER).get().byteValue()); /////////////////////// /// Diamond Ore /// /////////////////////// register(56, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(5.0))) .translation("tile.oreDiamond.name") .build("minecraft", "diamond_ore")); ///////////////////////// /// Diamond Block /// ///////////////////////// register(57, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.blockDiamond.name") .build("minecraft", "diamond_block")); ////////////////////////// /// Crafting Table /// ////////////////////////// register(58, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(2.5)) .add(blastResistance(12.5))) .translation("tile.workbench.name") .behaviors(pipeline -> pipeline .add(new CraftingTableInteractionBehavior())) .build("minecraft", "crafting_table")); // TODO: Wheat //////////////////// /// Farmland /// //////////////////// register(60, simpleBuilder() .collisionBox(BoundingBoxes.farmland()) .trait(LanternIntegerTraits.MOISTURE) .properties(builder -> builder .add(hardness(0.6)) .add(blastResistance(3.0))) .defaultState(state -> state.withTrait(LanternIntegerTraits.MOISTURE, 0).get()) .translation("tile.farmland.name") .build("minecraft", "farmland"), state -> state.getTraitValue(LanternIntegerTraits.MOISTURE).get().byteValue()); //////////////////// /// Furnace /// //////////////////// register(61, furnaceBuilder() .itemType() .translation("tile.furnace.name") .build("minecraft", "furnace"), this::directionData); //////////////////// /// Lit Furnace /// //////////////////// register(62, furnaceBuilder() .properties(builder -> builder .add(lightEmission(13))) .translation("tile.furnace.name") .build("minecraft", "lit_furnace"), this::directionData); //////////////////////////// /// Stone Pressure Plate /// //////////////////////////// register(70, pressurePlateBuilder() .translation("tile.pressurePlateStone.name") .build("minecraft", "stone_pressure_plate"), this::pressurePlateData); ///////////////////////////// /// Wooden Pressure Plate /// ///////////////////////////// register(72, pressurePlateBuilder() .translation("tile.pressurePlateWood.name") .build("minecraft", "wooden_pressure_plate"), this::pressurePlateData); //////////////////// /// Jukebox /// //////////////////// register(84, simpleBuilder() .itemType() .traits(LanternBooleanTraits.HAS_RECORD) .defaultState(state -> state .withTrait(LanternBooleanTraits.HAS_RECORD, false).get()) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(10.0))) .tileEntityType(() -> TileEntityTypes.JUKEBOX) .translation("tile.jukebox.name") .behaviors(pipeline -> pipeline .add(new JukeboxInteractionBehavior())) .build("minecraft", "jukebox"), state -> (byte) (state.getTraitValue(LanternBooleanTraits.HAS_RECORD).get() ? 1 : 0)); //////////////////// /// Pumpkin /// //////////////////// register(86, pumpkinBuilder() .itemType(builder -> builder .properties(properties -> properties .add(equipmentType(EquipmentTypes.HEADWEAR)))) .translation("tile.pumpkin.name") .build("minecraft", "pumpkin"), this::horizontalDirectionData); ////////////////////// /// Netherrack /// ////////////////////// register(87, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.4)) .add(blastResistance(2.0))) .translation("tile.hellrock.name") .build("minecraft", "netherrack")); //////////////////// /// Lit Pumpkin /// //////////////////// register(91, pumpkinBuilder() .properties(builder -> builder .add(lightEmission(15))) .translation("tile.litpumpkin.name") .build("minecraft", "lit_pumpkin"), this::horizontalDirectionData); ///////////////////// /// Stained Glass /// ///////////////////// register(95, dyedBuilder("tile.stainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass"), this::dyedData); /////////////////// /// Iron Bars /// /////////////////// register(101, simpleBuilder() // TODO .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(10.0))) .translation("tile.fenceIron.name") .build("minecraft", "iron_bars")); ///////////////////// /// End Stone /// ///////////////////// register(121, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.whiteStone.name") .build("minecraft", "end_stone")); ////////////////////////// /// Double Wooden Slab /// ////////////////////////// register(125, simpleBuilder() .traits(LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "double_wooden_slab"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId()); ////////////////////////// /// Wooden Slab /// ////////////////////////// register(126, simpleBuilder() .traits(LanternEnumTraits.PORTION_TYPE, LanternEnumTraits.TREE_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.PORTION_TYPE, LanternPortionType.BOTTOM).get() .withTrait(LanternEnumTraits.TREE_TYPE, LanternTreeType.OAK).get()) .translation(TranslationProvider.of(LanternEnumTraits.TREE_TYPE, type -> tr("tile.woodSlab." + type.getTranslationKeyBase() + ".name"))) .itemType(builder -> builder .behaviors(pipeline -> pipeline .add(new SlabItemInteractionBehavior<>(LanternEnumTraits.TREE_TYPE, () -> BlockTypes.WOODEN_SLAB, () -> BlockTypes.DOUBLE_WOODEN_SLAB)) .add(new PlacementCollisionDetectionBehavior())) .keysProvider(collection -> collection .register(Keys.TREE_TYPE, LanternTreeType.OAK) ) ) .collisionBox(BoundingBoxes::slab) .properties(builder -> builder .add(hardness(2.0)) .add(blastResistance(5.0))) .build("minecraft", "wooden_slab"), blockState -> { final int type = blockState.getTraitValue(LanternEnumTraits.TREE_TYPE).get().getInternalId(); final int portion = (byte) blockState.getTraitValue(LanternEnumTraits.PORTION_TYPE).get().getInternalId(); return (byte) (portion << 3 | type); }); ///////////////////// /// Ender Chest /// ///////////////////// register(130, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state.withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .itemType() .tileEntityType(() -> TileEntityTypes.ENDER_CHEST) .properties(builder -> builder .add(hardness(22.5)) .add(blastResistance(3000.0)) .add(lightEmission(7))) .translation("tile.enderChest.name") .collisionBox(BoundingBoxes.chest()) .behaviors(pipeline -> pipeline .add(new HorizontalRotationPlacementBehavior()) .add(new EnderChestInteractionBehavior())) .build("minecraft", "ender_chest"), this::horizontalFacingData); ///////////////////// /// Trapped Chest /// ///////////////////// register(146, chestBuilder() .translation("tile.chestTrap.name") .build("minecraft", "trapped_chest"), this::horizontalFacingData); /////////////////////////////////////// /// Weighted Pressure Plate (Light) /// /////////////////////////////////////// register(147, weightedPressurePlateBuilder() .translation("tile.weightedPlate_light.name") .build("minecraft", "light_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////////////////////// /// Weighted Pressure Plate (Heavy) /// /////////////////////////////////////// register(148, weightedPressurePlateBuilder() .translation("tile.weightedPlate_heavy.name") .build("minecraft", "heavy_weighted_pressure_plate"), this::weightedPressurePlateData); /////////////////////// /// Redstone Block /// /////////////////////// register(152, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(5.0)) .add(blastResistance(30.0))) .translation("tile.blockRedstone.name") .build("minecraft", "redstone_block")); //////////////////// /// Quartz Ore /// //////////////////// register(153, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(15.0))) .translation("tile.netherquartz.name") .build("minecraft", "quartz_ore")); //////////////////// /// Hopper /// //////////////////// register(154, simpleBuilder() .traits(LanternEnumTraits.HOPPER_FACING, LanternBooleanTraits.ENABLED) .defaultState(state -> state .withTrait(LanternEnumTraits.HOPPER_FACING, Direction.DOWN).get() .withTrait(LanternBooleanTraits.ENABLED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.0)) .add(blastResistance(8.0))) .translation("tile.hopper.name") .behaviors(pipeline -> pipeline .add(new HopperPlacementBehavior())) .build("minecraft", "hopper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.HOPPER_FACING).get()); if (!blockState.getTraitValue(LanternBooleanTraits.ENABLED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////// /// Quartz Block /// ////////////////////// register(155, simpleBuilder() .trait(LanternEnumTraits.QUARTZ_TYPE) .defaultState(state -> state .withTrait(LanternEnumTraits.QUARTZ_TYPE, LanternQuartzType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.QUARTZ_TYPE, LanternQuartzType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(2.4))) .translation(TranslationProvider.of(LanternEnumTraits.QUARTZ_TYPE)) .behaviors(pipeline -> pipeline .add(new QuartzLinesRotationPlacementBehavior())) .build("minecraft", "quartz_block"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.QUARTZ_TYPE).get().getInternalId()); //////////////////// /// Dropper /// //////////////////// register(158, simpleBuilder() .traits(LanternEnumTraits.FACING, LanternBooleanTraits.TRIGGERED) .defaultState(state -> state .withTrait(LanternEnumTraits.FACING, Direction.NORTH).get() .withTrait(LanternBooleanTraits.TRIGGERED, false).get()) .itemType() .properties(builder -> builder .add(hardness(3.5)) .add(blastResistance(17.5))) // .tileEntityType(() -> TileEntityTypes.DROPPER) .translation("tile.dropper.name") .behaviors(pipeline -> pipeline .add(new RotationPlacementBehavior())) .build("minecraft", "dropper"), blockState -> { int data = directionData(blockState.getTraitValue(LanternEnumTraits.FACING).get()); if (blockState.getTraitValue(LanternBooleanTraits.TRIGGERED).get()) { data |= 0x8; } return (byte) data; }); ////////////////////////////// /// Stained Hardended Clay /// ////////////////////////////// register(159, dyedBuilder("tile.clayHardenedStained.%s.name") .properties(builder -> builder .add(hardness(1.25)) .add(blastResistance(7.0))) .build("minecraft", "stained_hardened_clay"), this::dyedData); ////////////////////////// /// Stained Glass Pane /// ////////////////////////// register(160, dyedBuilder("tile.thinStainedGlass.%s.name") .properties(builder -> builder .add(hardness(0.3)) .add(blastResistance(1.5))) .build("minecraft", "stained_glass_pane"), this::dyedData); //////////////////// /// Leaves 2 /// //////////////////// register(161, leavesBuilder(LanternEnumTraits.LEAVES2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "leaves2"), blockState -> leavesData(blockState, blockState.getTraitValue(LanternEnumTraits.LEAVES2_TYPE).get().getInternalId() - 4)); //////////////////// /// Log 2 /// //////////////////// register(162, logBuilder(LanternEnumTraits.LOG2_TYPE, LanternTreeType.ACACIA) .build("minecraft", "log2"), blockState -> logData(blockState, blockState.getTraitValue(LanternEnumTraits.LOG2_TYPE).get().getInternalId() - 4)); //////////////////// /// Barrier /// //////////////////// register(166, simpleBuilder() .itemType() .properties(builder -> builder .add(PropertyProviderCollections.UNBREAKABLE)) .translation("tile.barrier.name") .build("minecraft", "barrier")); ///////////////////// /// Carpet /// ///////////////////// register(171, dyedBuilder("tile.carpet.%s.name") .properties(builder -> builder .add(hardness(0.1)) .add(blastResistance(0.5)) .add(solidMaterial(false))) .collisionBox(BoundingBoxes.carpet()) .build("minecraft", "carpet"), this::dyedData); ///////////////////// /// Red Sandstone /// ///////////////////// register(179, simpleBuilder() .trait(LanternEnumTraits.SANDSTONE_TYPE) .defaultState(state -> state.withTrait(LanternEnumTraits.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT).get()) .itemType(builder -> builder .keysProvider(collection -> collection .register(Keys.SANDSTONE_TYPE, LanternSandstoneType.DEFAULT) ) ) .properties(builder -> builder .add(hardness(0.8)) .add(blastResistance(4.0))) .translation(TranslationProvider.of(LanternEnumTraits.SANDSTONE_TYPE)) .build("minecraft", "red_sandstone"), blockState -> (byte) blockState.getTraitValue(LanternEnumTraits.SANDSTONE_TYPE).get().getInternalId()); /////////////////////////// /// Double Stone Slab 2 /// /////////////////////////// register(181, doubleStoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND) .translation("tile.stoneSlab2.name") .build("minecraft", "double_stone_slab2"), blockState -> doubleStoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); //////////////////////// /// Stone Slab 2 /// //////////////////////// register(182, stoneSlab(LanternEnumTraits.STONE_SLAB2_TYPE, LanternSlabType.RED_SAND, () -> BlockTypes.STONE_SLAB2, () -> BlockTypes.DOUBLE_STONE_SLAB2) .translation("tile.stoneSlab2.name") .collisionBox(BoundingBoxes::slab) .build("minecraft", "stone_slab2"), blockState -> stoneSlabData(blockState, blockState.getTraitValue(LanternEnumTraits.STONE_SLAB2_TYPE).get().getInternalId() - 8)); /////////////////// /// End Rod /// /////////////////// register(198, simpleBuilder() .itemType() .properties(builder -> builder .add(hardness(0.0)) .add(blastResistance(0.0)) .add(lightEmission(14))) .translation("tile.endRod.name") .build("minecraft", "end_rod")); /////////////////////////// /// White Shulker Box /// /////////////////////////// register(219, shulkerBox() .translation("tile.shulkerBoxWhite.name") .build("minecraft", "white_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Orange Shulker Box /// /////////////////////////// register(220, shulkerBox() .translation("tile.shulkerBoxOrange.name") .build("minecraft", "orange_shulker_box"), this::shulkerBoxData); //////////////////////////// /// Magenta Shulker Box /// //////////////////////////// register(221, shulkerBox() .translation("tile.shulkerBoxMagenta.name") .build("minecraft", "magenta_shulker_box"), this::shulkerBoxData); /////////////////////////////// /// Light Blue Shulker Box /// /////////////////////////////// register(222, shulkerBox() .translation("tile.shulkerBoxLightBlue.name") .build("minecraft", "light_blue_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Yellow Shulker Box /// /////////////////////////// register(223, shulkerBox() .translation("tile.shulkerBoxYellow.name") .build("minecraft", "yellow_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Lime Shulker Box /// ///////////////////////// register(224, shulkerBox() .translation("tile.shulkerBoxLime.name") .build("minecraft", "lime_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Pink Shulker Box /// ///////////////////////// register(225, shulkerBox() .translation("tile.shulkerBoxPink.name") .build("minecraft", "pink_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(226, shulkerBox() .translation("tile.shulkerBoxGray.name") .build("minecraft", "gray_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Gray Shulker Box /// ///////////////////////// register(227, shulkerBox() .translation("tile.shulkerBoxSilver.name") .build("minecraft", "silver_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Cyan Shulker Box /// ///////////////////////// register(228, shulkerBox() .translation("tile.shulkerBoxCyan.name") .build("minecraft", "cyan_shulker_box"), this::shulkerBoxData); /////////////////////////// /// Purple Shulker Box /// /////////////////////////// register(229, shulkerBox() .translation("tile.shulkerBoxPurple.name") .build("minecraft", "purple_shulker_box"), this::shulkerBoxData); ///////////////////////// /// Blue Shulker Box /// ///////////////////////// register(230, shulkerBox() .translation("tile.shulkerBoxBlue.name") .build("minecraft", "blue_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Brown Shulker Box /// ////////////////////////// register(231, shulkerBox() .translation("tile.shulkerBoxBrown.name") .build("minecraft", "brown_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Green Shulker Box /// ////////////////////////// register(232, shulkerBox() .translation("tile.shulkerBoxGreen.name") .build("minecraft", "green_shulker_box"), this::shulkerBoxData); //////////////////////// /// Red Shulker Box /// //////////////////////// register(233, shulkerBox() .translation("tile.shulkerBoxRed.name") .build("minecraft", "red_shulker_box"), this::shulkerBoxData); ////////////////////////// /// Black Shulker Box /// ////////////////////////// register(234, shulkerBox() .translation("tile.shulkerBoxBlack.name") .build("minecraft", "black_shulker_box"), this::shulkerBoxData); ////////////// /// Sign /// ////////////// register(63, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "standing_sign"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(68, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.SIGN) .build("minecraft", "wall_sign"), this::horizontalFacingData); //////////////// /// Banner /// //////////////// register(176, simpleBuilder() .trait(LanternIntegerTraits.ROTATION) .defaultState(state -> state .withTrait(LanternIntegerTraits.ROTATION, 0).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "standing_banner"), blockState -> blockState.getTraitValue(LanternIntegerTraits.ROTATION).get().byteValue()); register(177, simpleBuilder() .trait(LanternEnumTraits.HORIZONTAL_FACING) .defaultState(state -> state .withTrait(LanternEnumTraits.HORIZONTAL_FACING, Direction.NORTH).get()) .properties(builder -> builder .add(hardness(1.0)) .add(blastResistance(5.0))) .behaviors(pipeline -> pipeline .add(new SignInteractionBehavior())) .tileEntityType(() -> TileEntityTypes.BANNER) .build("minecraft", "wall_banner"), this::horizontalFacingData); // @formatter:on }
NONSATD
true
return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED)
facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7))
.withTrait(LanternEnumTraits.BED_PART, LanternBedPart.FOOT).get() .withTrait(LanternBooleanTraits.OCCUPIED, false).get()) .properties(builder -> builder .add(hardness(0.2)) .add(blastResistance(1.0))) .translation("tile.bed.name") .build("minecraft", "bed"), blockState -> { final Direction facing = blockState.getTraitValue(LanternEnumTraits.HORIZONTAL_FACING).get(); int type = facing == Direction.SOUTH ? 0 : facing == Direction.WEST ? 1 : facing == Direction.NORTH ? 2 : facing == Direction.EAST ? 3 : -1; checkArgument(type != -1); if (blockState.getTraitValue(LanternBooleanTraits.OCCUPIED).get()) { type |= 0x4; } if (blockState.getTraitValue(LanternEnumTraits.BED_PART).get() == LanternBedPart.HEAD) { type |= 0x8; } return (byte) type; }); ////////////////////// /// Golden Rail /// ////////////////////// register(27, simpleBuilder() .traits(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternBooleanTraits.POWERED) .defaultState(state -> state .withTrait(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION, LanternRailDirection.NORTH_SOUTH).get() .withTrait(LanternBooleanTraits.POWERED, false).get()) .itemType() .selectionBox(BoundingBoxes::rail) .properties(builder -> builder .add(PASSABLE) .add(hardness(0.7)) .add(blastResistance(3.5))) .translation("tile.goldenRail.name") .build("minecraft", "golden_rail"), blockState -> { int type = blockState.getTraitValue(LanternEnumTraits.STRAIGHT_RAIL_DIRECTION).get().getInternalId(); if (blockState.getTraitValue(LanternBooleanTraits.POWERED).get()) { type |= 0x8; } return (byte) type; });